package com.authority.service;


import java.util.List;
import java.util.Map;

import com.authority.entry.AuthMenuDO;
import com.authority.entry.AuthRoleDO;
import com.authority.entry.AuthRoleMenuDO;
import com.authority.query.AuthRoleQuery;
import com.authority.result.PageResult;
import com.authority.tree.Node;
import com.authority.vo.AuthRoleVO;
import com.authority.vo.IdNameVO;

/**
 * 角色管理
 * 
 * @author limeng.g
 * 
 */
public interface AuthRoleService {

	/**
	 * 角色列表查询
	 * @param query
	 * @return
	 * @throws Exception 
	 */
	PageResult<AuthRoleVO> listAuthRole(AuthRoleQuery query) throws Exception;

	/**
	 * 添加角色
	 * @param authRoleDO  角色基本信息
	 * @param list  角色权限列表
	 * @return
	 * @throws Exception 
	 */
	void saveAuthRole(AuthRoleDO db,List<AuthRoleMenuDO> list) throws Exception;
	
	/**
	 * 更新角色
	 * @param authRoleDO  角色基本信息
	 * @param list  角色权限列表
	 * @return
	 * @throws Exception 
	 */
	void updateAuthRole(AuthRoleDO db,List<AuthRoleMenuDO> list) throws Exception;


	/**
	 * 获取角色信息
	 * @param id
	 * @return
	 */
	AuthRoleDO getAuthRoleById(Long id);
	
	/**
	 * 获取权限列表
	 */
	List<AuthMenuDO> listAuthMenuByRoleIdAndSysId(Long roleId,Long sysId);
	
	/**
	 * 获取已选择的菜单树
	 * @return
	 */
	Node treeCheckedMenu(Long roleId, Long sysId);
	
	/**
	 * 获取未选择的菜单树
	 * @param sysId
	 * @return
	 */
	Node treeUncheckedMenu(Long sysId);
	
	/**
	 * 获取简单角色列表
	 * @return
	 */
	List<IdNameVO> listAuthRoleIdName(Long sysId);
	
	/**
	 * 根据角色类型进行分组
	 * @return
	 */
	Map<String, List<IdNameVO>> listAuthRoleGroupByType(Long sysId);
	
	List<AuthRoleVO> getRoleList(AuthRoleQuery query) throws Exception;
	
}
